package gen.tools.query;

import gen.tools.Widgets;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class QuerySVNver extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
    public QuerySVNver() {
        super();
    }

	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		doPost(request,response);
	}

	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		final Widgets wid = new Widgets();
		request.setCharacterEncoding( wid.UIcodeSet );
		response.setCharacterEncoding( wid.UIcodeSet );
		response.setContentType("application/text");
		
		final String url = request.getParameter("url");
		final String usr = request.getParameter("usr");
		final String pwd = request.getParameter("pwd");
		String res = "";
		
		try {
			res = String.valueOf( wid.getSVNver(url, usr, pwd) );
		} catch( Exception e) {
			wid.errLog(e);
			res = wid.errProcess4HTML(e);
		}
		
		response.getWriter().write( res );
	}

}
